﻿<%@ Page Title="IC.NET Router Rules Manager" Language="C#" MasterPageFile="~/Rules.Master" AutoEventWireup="true" CodeFile="Rules.aspx.cs" Inherits="ICNETREST.Rules1" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
  <script src="Scripts/RulesManager.js" type="text/javascript"></script>

  <script type="text/javascript">
    $(function () {
      RulesManager.initialize();
    });

  </script>

</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PageTitleContent" runat="server">Router Rules Manager</asp:Content>
<asp:Content ID="ContentTitle" ContentPlaceHolderID="TitleContent" runat="server">Router Rules Manager</asp:Content>
<asp:Content ID="TitleContentDescription" ContentPlaceHolderID="TitleContentDescriptionContent" runat="server">
    <p><small>A webapp to help you manage router rules</small></p>
    <p>Router rules are simple logic that tells the ICNET server where to dispatch incoming messages.  Using this webapp, you direct the router to dispatch
        messages to only those roles that will find the message useful.</p>
    <p>All current values for each of the router rules are listed in the table below.  In addition, you can perform these operations on each of the rules</p>
        <ul>
            <li>To <strong>add</strong> a new rule, click on the <em>Add New Rule</em> tab.  Fill in the form, and click on the <em>Add Rule</em> button. </li>
            <li>To <strong>modify</strong> an existing value list, click on the row corresponding to the rule you want to modify.  A form will pop up.  
                Fill in the form to modify the rule, and click on the <em>Modify Rule</em> button.</li>
            <li>To <strong>delete</strong> an existing rule, click on the row corresponding to the rule you want to delete.  A form will pop up.
                Make sure that the values in the form correspond to the rule you want to delete---<em class="text-error">this action cannot be undone!</em>.  Click on the
                <em>Delete Rule</em> button.
            </li>
        </ul>
    
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div id="tabs">
	    <ul>
		    <li><a href="#tabs-1">Existing Rules</a></li>
		    <li><a href="#tabs-2">Add New Rule</a></li>
	    </ul>

	    <div id="tabs-1">
		    <h1>Current Rules:</h1>
        <div id="table">
          <table class="striped" id="rulestable">
            
          </table>
        </div>
	    </div>

	    <div id="tabs-2">
        <h2>Create New Rule</h2>
        <div id="error" class="ui-state-error"></div>
		    <form action="#" class="ui-corner-all" id="rulesform">

          <label for="type">Rule Type</label>
          <select id="type">
            <option value="Default">Select a rule type</option>
            <option value="ContentKeyword" selected="selected">ContentKeywords</option>
            <option value="ContentKeywordFed">ContentKeywordFed</option>
          </select>

          <label for="furi">From List URI</label>
          <select id="furi" >
            <option value= "Default">Select a URI</option>
            <option selected="selected">http://icnet.mitre.org/ValueLists/ContentKeywords</option>
          </select>
 
          <label for="fval">From Value</label>
          <select id="fval">
            <option value="Default">Select a value</option>
          </select>
          
          <div id="turidiv">
            <label for="turi">To List URI</label>
            <select id="turi">
              <option value= "Default">Select a URI</option>
            </select>
          </div>

          <div id="tfeduridiv" style="display: none;">
            <label for="tfeduri">To Federation URI</label>
            <input type="text" size="40" id="tfeduri" />
          </div>

          <div id="tvaldiv">
            <label for="tval">To Value:</label>
            <select id="tval">
              <option value="Default">Select a value</option>
            </select>
          </div>
   
          <br /><br />
          <button type="button" id="addRuleButton">Add Rule</button>
        </form>
	    </div>
    </div>
       
    <div id="dialog" title="Modify Rule">
      <h2>Modify Rule</h2>
      <div id="modify" class="ui-state-error"></div>
		  <form action="#" class="ui-corner-all" id="modifiedform">
          
        <label for="modtype">Rule Type</label>
        <select id="modtype">
          <option value="Default">Select a rule type</option>
          <option value="ContentKeyword" selected="selected">ContentKeywords</option>
          <option value="ContentKeywordFed" selected="selected">ContentKeywordFed</option>
        </select>

        <label for="modfuri">From List URI</label>
        <select id="modfuri">
          <option value= "Default">Select a URI</option>
          <option selected="selected">http://icnet.mitre.org/ValueLists/ContentKeywords</option>
        </select>
 
        <label for="modfval">From Value</label>
        <select id="modfval">
          <option value="Default">Select a value</option>
        </select>
        
        <div id="modtouri">
            <label for="modturi">To List URI</label>
            <select id="modturi">
              <option value= "Default">Select a URI</option>
            </select>
        </div>

        <div id="modtofeduridiv" style="display: none;">
            <label for="modtofeduri">To Federation URI</label>
            <input type="text" size="40" id="modtofeduri" />
        </div>

        <div id="modtoval">
            <label for="modtval">To Value:</label>
            <select id="modtval">
              <option value="Default">Select a value</option>
            </select>
        </div>
        <br /><br />

        <button type="button" id="modifyRuleButton">Modify Rule</button> <br />
        <button type="button" id="deleteRuleButton">Delete Rule</button>
      </form>
</div>

</asp:Content>

